﻿@model CampWeek5__Book_Project_.Models.IndexVM

<br />

        <form method="get" action="@Url.Action("ResultsPage","Home")">
            <div class="row">
                <div class="col-lg-6">
                    <div class="input-group">
                        <label for="isbn">ISBN: </label>
                        <input name="isbn" placeholder="ISBN..." class="form-control" />
                        <button style="float:right">Search ISBN</button>
                    </div>
                    <div class="input-group">
                        <label for="title">Title: </label>
                        <input name="title" placeholder="Title..." class="form-control" />
                        <button style="float:right">Search Title</button>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="input-group">
                        <label for="genre">Genre: </label>
                        <input name="genre" placeholder="Genre..." class="form-control" />
                        <button style="float:right">Search Genre</button>
                    </div>
                    <div class="input-group">
                        <label for="author">Author: </label>
                        <input name="author" placeholder="Author..." class="form-control" />
                        <button style="float:right">Search Author</button>
                    </div>
                </div>
            </div>
</form>


<h2>Book of The Day</h2>
<div class="row well-lg container" id="BoDBox">
    <div class="col-lg-2 ">
        <img id="BookODay" src="@Model.FeaturedBook.BookImg" />
    </div>
    <div class="col-lg-10 col-md-9 cold-sm-8 col-xs-6">
        <a href="/Details/BookDetail/@Model.FeaturedBook.ISBN" style="color: black">
            <h3>@Model.FeaturedBook.Title</h3>
        </a>
        <strong>@Model.FeaturedBook.Summary</strong><br />
        Written By: @Model.FeaturedBook.AuthorName and given a score of  @Math.Round(Model.FeaturedBook.BookRating, 1) / 5
        @if (User.Identity.IsAuthenticated)
        {
            <br />
            <a href="/Home/FeaturedBooks" style="color:red;">Choose New Book</a>
        }
    </div>
</div>
<h2>See What Everyone Else Is Reading</h2>

<div class="row">

    @foreach (var b in Model.Books.Take(6))
    {

        <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">

            <br />
            <a style="color:black;" href="/Details/BookDetail/@b.ISBN">
                <img id="fp" src="@b.BookImg" />
                <br />
                @b.Title
                <br />
                @{
        if (b.BookRating > 0)
        {
            <span>@Math.Round(b.BookRating, 1)</span>
        }
        else
        {
            <strong>Sorry no ratings yet!</strong>
        }
                }
            </a>
            <br />
        </div>
    }
</div>
<h2>Most Popular Authors</h2>
<div class="row">
    @foreach (var a in Model.Authors.Take(6))
    {

        <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">

            <br />
            <a style="color:black;" href="/Details/AuthorDetail/@a.AuthorId">
                <img id="fp" src="@a.AuthorImg" />
                <br />
                @a.AuthorName
            </a>
        </div>

    }
</div>